module.exports = class HtmlTpl {
    constructor(tpl, data) {
        this.tpl = tpl;
        this.data = data || {};
    }
    
    compile(data) {
        if(data) {
            this.setData(data);
        }
        
        data = this.data;
        return eval("`"+ this.tpl.replace(/\\/g, '\\\\').replace(/`/g, '\`') +"`;");
    }
    
    setData(data) {
        this.data = data;
    }
}
